<template>
  <a-layout class="layout" :class="[device]">

    <template v-if="layoutMode === 'sidemenu sidemenu1'">
      <a-drawer
        v-if="device === 'mobile'"
        :wrapClassName="'drawer-sider ' + navTheme"
        placement="left"
        @close="() => this.collapsed = false"
        :closable="false"
        :visible="collapsed"
        width="200px"
      >
        <side-menu
          mode="inline"
          v-if="device === 'mobile'"
          :menus="menus"
          @menuSelect="menuSelect"
          :theme="navTheme"
          :collapsed="false"
          :collapsible="true"></side-menu>
      </a-drawer>

      <side-menu
        v-show="device === 'desktop'"
        mode="inline"
        :menus="menus"
        @menuSelect="myMenuSelect"
        :theme="navTheme"
        :collapsed="collapsed"
        :collapsible="true"></side-menu>
    </template>

    <!-- 简约菜单模式 -->
    <template v-else-if="layoutMode === 'briefMenu'">
      <a-drawer
        v-if="device === 'mobile'"
        :wrapClassName="'drawer-sider ' + navTheme"
        placement="left"
        @close="() => this.collapsed = false"
        :closable="false"
        :visible="collapsed"
        width="200px"
      >
        <side-menu
          mode="inline"
          v-if="device === 'mobile'"
          :menus="menus"
          @menuSelect="menuSelect"
          :theme="navTheme"
          :collapsed="true"
          :collapsible="true"></side-menu>
      </a-drawer>

      <side-menu
        v-show="device === 'desktop'"
        mode="vertical"
        :menus="menus"
        @menuSelect="myMenuSelect"
        :theme="navTheme"
        :collapsed="true"
        :collapsible="true"
        :menuType="layoutMode"
        />
    </template>

    <!-- 混合菜单模式 -->
    <template v-else-if="layoutMode === 'mixedMenu'">
      <a-drawer
        v-if="device === 'mobile'"
        :wrapClassName="'drawer-sider ' + navTheme"
        placement="left"
        @close="() => this.collapsed = false"
        :closable="false"
        :visible="collapsed"
        width="200px"
      >
        <side-menu
          mode="inline"
          v-if="device === 'mobile'"
          :menus="menus"
          @menuSelect="menuSelect"
          :theme="navTheme"
          :collapsed="true"
          :collapsible="true"></side-menu>
      </a-drawer>

      <side-menu
        v-show="device === 'desktop' && showSide"
        mode="inline"
        :menus="sideMenuData"
        @menuSelect="myMenuSelect"
        :theme="navTheme"
        :collapsed="collapsed"
        :collapsible="true"
        @changeSide="changeSide"
        ></side-menu>
    </template>

    <!-- 下次优化这些代码 -->
    <template v-else>
      <a-drawer
        v-if="device === 'mobile'"
        :wrapClassName="'drawer-sider ' + navTheme"
        placement="left"
        @close="() => this.collapsed = false"
        :closable="false"
        :visible="collapsed"
        width="200px"
      >
        <side-menu
          mode="inline"
          :menus="menus"
          @menuSelect="menuSelect"
          :theme="navTheme"
          :collapsed="false"
          :collapsible="true"></side-menu>
      </a-drawer>
    </template>

    <a-layout
      :class="[layoutMode, `content-width-${contentWidth}`]"
      :style="{ paddingLeft: headerPaddingLeft() }">
      <!-- layout header -->
      <global-header
        :mode="layoutMode"
        :menus="headMenuData"
        :theme="navTheme"
        :collapsed="collapsed"
        :device="device"
        @toggle="toggle"
      />

      <!-- layout content -->
      <a-layout-content :style="{ height: '100%', paddingTop: fixedHeader ? '60px' : '0' }">
        <slot></slot>
      </a-layout-content>

      <!-- layout footer -->
      <a-layout-footer style="padding: 0px">
        <global-footer/>
      </a-layout-footer>
    </a-layout>

    <!-- 编译主题颜色已生效，但还一直转圈，显示主题 正在编译 -->
    <!--<setting-drawer></setting-drawer>-->
  </a-layout>
</template>

<script>
  import SideMenu from '@/components/menu/SideMenu'
  import GlobalHeader from '@/components/page/GlobalHeader'
  import GlobalFooter from '@/components/page/GlobalFooter'
  // 编译主题颜色已生效，但还一直转圈，显示主题 正在编译 ------
  // import SettingDrawer from '@/components/setting/SettingDrawer'
  // 注释这个因为在个人设置模块已经加载了SettingDrawer页面

  import { triggerWindowResizeEvent } from '@/utils/util'
  import { mapState, mapActions, mapGetters, mapMutations } from 'vuex'
  import { mixin, mixinDevice } from '@/utils/mixin.js'

  export default {
    name: 'GlobalLayout',
    components: {
      SideMenu,
      GlobalHeader,
      GlobalFooter,
      // 编译主题颜色已生效，但还一直转圈，显示主题 正在编译
      // // SettingDrawer
      // 注释这个因为在个人设置模块已经加载了SettingDrawer页面
    },
    mixins: [mixin, mixinDevice],
    data() {
      return {
        collapsed: false,
        activeMenu:{},
        menus: []
      }
    },
    watch: {
      sidebarOpened(val) {
        this.collapsed = !val
      },
      $route(val) {
        this.setActivated(val)
      },
      layout() {
        this.setActivated(this.$route)
      }
    },
    computed: {
      sideMenuWidth() {
        return this.collapsed ? '80px' : '210px'
      },
      ...mapState({
        // 主路由
        mainRouters: state => state.permission.addRouters,
        // 后台菜单
        permissionMenuList: state => state.user.permissionList,
        fixedSideBar: state => state.fixSiderbar
      }),

      ...mapGetters(
        ['menuData', 'firstMenu', 'subMenu', 'showSide', 'fixedHeader', 'layout']
      ),
      headerStyle() {
        let width = (this.fixedHeader && this.layoutMode !== 'briefMenu' && !this.isMobile) ? `calc(100% - ${this.sideMenuWidth})` : '100%'
        let position = this.fixedHeader ? 'fixed' : 'static'
        return `width: ${width}; position: ${position};`
      },
      headMenuData() {
        const {menuData, firstMenu} = this
        return this.layoutMode === 'mixedMenu' ? firstMenu : menuData
      },
      sideMenuData() {
        const {menuData, subMenu} = this
        return this.layoutMode === 'mixedMenu' ? subMenu : menuData
      }
    },
    created() {
      this.menus = this.permissionMenuList
      this.setActivated(this.$route)
    },
    methods: {
      headerPaddingLeft() {

        if (this.fixedHeader || this.fixSiderbar) {
          if (this.layoutMode === 'sidemenu') {
            if (this.collapsed) {
              return '80px'
            }
            return '208px'
          }
          if (this.layoutMode === 'briefMenu') return '90px'
          if (this.layoutMode === 'mixedMenu' && this.showSide) return '208px'
          return '0'
        } else {
          return '0'
        }

      },
      headerPaddingTop() {

      },
      changeSide(val) {
        this.SET_SHOW_SIDE(val)
      },
      ...mapActions(['setSidebar']),
      ...mapMutations(['SET_ACTIVATED_FIRST', 'SET_SHOW_SIDE']),
      toggle() {
        this.collapsed = !this.collapsed
        this.setSidebar(!this.collapsed)
        triggerWindowResizeEvent()
      },
      setActivated(route) {
        if (this.layoutMode === 'mixedMenu') {
          let matched = route.matched
          matched = matched.slice(0, matched.length)
          const {firstMenu} = this
          for (let menu of firstMenu) {
            if (matched.findIndex(item => item.path === menu.path) !== -1) {
              this.SET_ACTIVATED_FIRST(menu.path)
              break
            }
          }
        }
      },
      menuSelect() {
        if (!this.isDesktop()) {
          this.collapsed = false
        }
      },
      //动态路由title显示配置的菜单title而不是其对应路由的title
      myMenuSelect(value){
        //此处触发动态路由被点击事件
        this.findMenuBykey(this.menus,value.key)
        this.$emit("dynamicRouterShow",value.key,this.activeMenu.meta.title)
        // 修复刷新后菜单Tab名字显示异常
        let storeKey = 'route:title:' + this.activeMenu.path
        this.$ls.set(storeKey, this.activeMenu.meta.title)

      },
      findMenuBykey(menus,key){
        for(let i of menus){
          if(i.path==key){
            this.activeMenu = {...i}
          }else if(i.children && i.children.length>0){
            this.findMenuBykey(i.children,key)
          }
        }
      }
    }
  }

</script>

<style lang="less">
  body {
    // 打开滚动条固定显示
    overflow-y: scroll;
    &.colorWeak {
      filter: invert(80%);
    }
  }

  .layout {
    min-height: 100vh !important;
    overflow-x: hidden;

    &.mobile {

      .ant-layout-content {

        .content {
          margin: 24px 0 0;
        }
      }

      /**
       * ant-table-wrapper
       * 覆盖的表格手机模式样式，如果想修改在手机上表格最低宽度，可以在这里改动
       */
      .ant-table-wrapper {
        .ant-table-content {
          overflow-y: auto;
        }
        .ant-table-body {
          min-width: 800px;
        }
      }
      .sidemenu {
        .ant-header-fixedHeader {

          &.ant-header-side-opened, &.ant-header-side-closed {
            width: 100%
          }
        }
      }

      .topmenu {
        /* 必须为 topmenu  才能启用流式布局 */
        &.content-width-Fluid {
          .header-index-wide {
            margin-left: 0;
          }
        }
      }
      .header, .top-nav-header-index {
        .user-wrapper .action {
          padding: 0 12px;
        }
      }
    }

    &.ant-layout-has-sider {
      flex-direction: row;
    }

    .trigger {
      font-size: 18px;
      line-height: 42px;
      padding: 0 18px;
      cursor: pointer;
      transition: color 300ms, background 300ms;

      &:hover {
        background: rgba(255, 255, 255, 0.3);
      }
    }

    .topmenu {
      .ant-header-fixedHeader {
        position: fixed;
        top: 0;
        right: 0;
        z-index: 9;
        width: 100%;
        transition: width .2s;

        &.ant-header-side-opened {
          width: 100%;
        }

        &.ant-header-side-closed {
          width: 100%;
        }


      }
      .ant-menu-dark.ant-menu-horizontal > .ant-menu-submenu.ant-menu-submenu-selected{
        background: #1890ff;
      }
      /* 必须为 topmenu  才能启用流式布局 */
      &.content-width-Fluid {
        .header-index-wide {
          max-width: unset;
          margin-left: 24px;
        }

        .page-header-index-wide {
          max-width: unset;
        }
      }

    }

    .sidemenu {
      .ant-header-fixedHeader {
        position: fixed;
        top: 0;
        right: 0;
        z-index: 9;
        width: 100%;
        transition: width .2s;

        &.ant-header-side-opened {
          width: calc(100% - 208px)
        }

        &.ant-header-side-closed {
          width: calc(100% - 80px)
        }
      }
    }

    .header {
      height: 64px;
      padding: 0 12px 0 0;
      background: #fff;
      box-shadow: 0 1px 4px rgba(0, 21, 41, .08);
      position: relative;
    }

    .header, .top-nav-header-index {

      .user-wrapper {
        float: right;
        height: 100%;

        .action {
          cursor: pointer;
          padding: 0 14px;
          display: inline-block;
          transition: all .3s;

          height: 70%;
          line-height: 46px;

          &.action-full {
            height: 100%;
          }

          &:hover {
            background: rgba(255, 255, 255, 0.3);
          }

          .avatar {
            margin: 20px 10px 20px 0;
            color: #1890ff;
            background: hsla(0, 0%, 100%, .85);
            vertical-align: middle;
          }

          .icon {
            font-size: 16px;
            padding: 4px;
          }

          .anticon {
            color: inherit;
          }
        }
      }

      &.dark {
        .user-wrapper {

          .action {
            color: black;

            &:hover {
              background: rgba(0, 0, 0, 0.05);
            }

            .anticon {
              color: inherit;
            }
          }
        }
      }
    }

    &.mobile {
      .top-nav-header-index {

        .header-index-wide {

          .header-index-left {

            .trigger {
              color: rgba(255, 255, 255, 0.85);
              padding: 0 12px;
            }

            .logo.top-nav-header {
              text-align: center;
              width: 56px;
              line-height: 58px;
            }
          }
        }

        .user-wrapper .action .avatar {
          margin: 20px 0;
        }

        &.light {

          .header-index-wide {

            .header-index-left {
              .trigger {
                color: rgba(0, 0, 0, 0.65);
              }
            }
          }
          //
        }
      }
    }

    &.tablet {
      // overflow: hidden; text-overflow:ellipsis; white-space: nowrap;
      .top-nav-header-index {

        .header-index-wide {

          .header-index-left {
            .logo > a {
              overflow: hidden;
              text-overflow: ellipsis;
              white-space: nowrap;
            }
          }
        }
      }

    }

    .top-nav-header-index {
      box-shadow: 0 1px 4px rgba(0, 21, 41, .08);
      position: relative;
      transition: background .3s, width .2s;

      .header-index-wide {
        width: 100%;
        margin: auto;
        padding: 0 20px 0 0;
        display: flex;
        height: 60px;

        .ant-menu.ant-menu-horizontal {
          border: none;
          height: 64px;
          line-height: 64px;
        }

        .header-index-left {
          flex: 1 1;
          display: flex;

          .logo.top-nav-header {
            width: 240px;
            height: 60px;
            float: left;
            position: relative;
            line-height: 60px;
            transition: all .3s;
            overflow: hidden;
            padding-left: 10px;
            img {
              display: inline-block;
              vertical-align: middle;
              height: 32px;
            }

            h1 {
              color: #fff;
              display: inline-block;
              vertical-align: top;
              font-size: 20px;
              margin: 0 0 0 12px;
              font-weight: 700;
            }
          }
        }

        .header-index-right {
          float: right;
          height: 60px;
          overflow: hidden;
          .action:hover {
            background-color: rgba(0, 0, 0, 0.05);
          }
        }
      }

      &.light {
        background-color: @primary-color;
        .header-index-wide {
           .header-index-right{
            color: #fff;
          }
          .header-index-left {
            .logo {
              h1 {
                color: #fff;
              }
            }
            .ant-menu{
              background: none;
              .ant-menu-item-selected,.ant-menu-submenu-selected{
                background:#007bec;
                border: none;
                top: 0;
                margin-top: 0;
              }
              .ant-menu-item-selected:hover,.ant-menu-submenu:hover{
                background:#0988fd;
                border: none;
                top: 0;
              }
              .ant-menu-item{
                a{
                  color: #fff !important;
                  bottom: 0;
                }
              }
              .ant-menu-submenu{
                .ant-menu-submenu-title{
                 span{
                   color: #fff;
                 }
                }
              }
            }
          }
        }
      }

      &.dark {
        .user-wrapper {
          .action {
            color: white;
            &:hover {
              background: rgba(255, 255, 255, 0.3);
            }
          }
        }
        .header-index-wide .header-index-left .trigger:hover {
          background: rgba(255, 255, 255, 0.3);
        }
      }

    }
    .ant-menu-light .ant-menu-item > a,
    .ant-menu-light .ant-menu-submenu-title span{
      color:#666;
    }
    .ant-menu-light.ant-menu-horizontal .ant-menu-item > a,
    .ant-menu-light.ant-menu-horizontal .ant-menu-submenu-title span{
      color: #333;
    }
    .ant-menu.ant-menu-light:not(.ant-menu-horizontal) .ant-menu-item-selected{
      background-color: @primary-color;
    }
    .ant-menu.ant-menu-light .ant-menu-item-selected > a,
    .ant-menu-light .ant-menu-light .ant-menu-item-selected > a:hover,
    .ant-menu.ant-menu-root.ant-menu-light > .ant-menu-item:first-child.ant-menu-item-selected > a,
    .ant-menu.ant-menu-root.ant-menu-light > .ant-menu-item:first-child.ant-menu-item-selected > a i,
    .ant-menu.ant-menu-root.ant-menu-light > .ant-menu-item:first-child.ant-menu-item-selected > a:hover,
     .sider.light .ant-menu.ant-menu-light:not(.ant-menu-horizontal) .ant-menu-item-selected:hover a span,
    .ant-menu.ant-menu-root.ant-menu-light > .ant-menu-item:first-child.ant-menu-item-selected:hover i,
    .sider.light ul.ant-menu.ant-menu-light .ant-menu-inline.ant-menu-sub .ant-menu-item-selected:hover i{
      color: #fff;
    }
    /*编译时需要将data-v-090c6f46替换为 data-v-51942c36*/
    .sider.light ul.ant-menu .ant-menu-item:hover i,
    .sider.light ul.ant-menu .ant-menu-item:hover span,
    .sider.light ul.ant-menu .ant-menu-submenu-title:hover i,
    .sider.light ul.ant-menu .ant-menu-submenu-title:hover span,
    .ant-menu-light.ant-menu-inline .ant-menu-submenu-open .ant-menu-submenu-title,
    .ant-menu-light.ant-menu-inline .ant-menu-submenu-open .ant-menu-submenu-title span,
    .ant-menu-light.ant-menu-inline .ant-menu-submenu-open .ant-menu-submenu-title i，
    .layout .ant-menu-submenu-title:hover span,
    .ant-menu-light.ant-menu-horizontal > .ant-menu-submenu:hover span,
    .ant-menu-light.ant-menu-horizontal > .ant-menu-item > a:hover{
      color: @primary-color;
    }
    .ant-menu-light .ant-menu-submenu-open .ant-menu-submenu-title .ant-menu-submenu-arrow::after,
    .ant-menu-light .ant-menu-sub.ant-menu-submenu-open .ant-menu-submenu-title .ant-menu-submenu-arrow::after,
    .ant-menu-light .ant-menu-submenu-open .ant-menu-submenu-title .ant-menu-submenu-arrow::before,
    .ant-menu-light .ant-menu-sub.ant-menu-submenu-open .ant-menu-submenu-title .ant-menu-submenu-arrow::before{
      background: @primary-color;
    }
    .ant-menu.ant-menu-light.ant-menu-horizontal > .ant-menu-submenu.ant-menu-submenu-horizontal,
    .ant-menu.ant-menu-light.ant-menu-horizontal > .ant-menu-submenu.ant-menu-submenu-horizontal:hover,
    .ant-menu.ant-menu-light.ant-menu-horizontal > .ant-menu-item,
    .ant-menu.ant-menu-light.ant-menu-horizontal > .ant-menu-item:hover{
      border-bottom:none;
      top: 0;
    }
    // 内容区
    .layout-content {
      margin: 24px 24px 0px;
      height: 64px;
      padding: 0 12px 0 0;
    }

  }


  .topmenu {
    .page-header-index-wide {
      margin: 0 auto;
      width: 100%;
    }
   /deep/ .ant-menu-dark{
     /*background-color: rgb(48, 65, 86);*/
     /deep/ .ant-menu-submenu:hover{
       background-color: @primary-color;
     }
     /deep/ .ant-menu-item:hover{
       background-color: @primary-color;
     }
   }
    /deep/ .ant-menu.ant-menu-dark .ant-menu-item-selected{
      background-color: @primary-color;
    }
    /deep/ .ant-menu.ant-menu-dark .ant-menu-item-selected i{
      color: rgb(24, 144, 255);
    }
    /deep/ .ant-menu.ant-menu-dark .ant-menu-item-selected span{
      color: rgb(24, 144, 255);
    }
    /deep/ .ant-menu-dark .ant-menu-submenu-active{
      color: #FFFFFF !important;
    }
  }
   .layout .top-nav-header-index.dark .user-wrapper .action:hover{
    background-color: @primary-color !important;
  }
  .layout .top-nav-header-index .dark .user-wrapper .action i{
    color: #FFFFFF !important;
  }
  .layout .top-nav-header-index .user-wrapper .action .anticon{
    color: inherit !important;
  }
  .dark.ant-dropdown-menu{
    background-color: #999999;
  }
  .sider.dark ul.ant-menu.ant-menu-dark{
    background: #001529;
  }
  .sider.dark ul.ant-menu.ant-menu-dark .ant-menu-inline.ant-menu-sub .ant-menu-item-selected,
  .sider.dark ul.ant-menu.ant-menu-dark .ant-menu-item-selected,
  .ant-menu-submenu-popup.ant-menu-dark .ant-menu-item-selected{
    background-color: @primary-color;
  }
  .sider.dark ul.ant-menu.ant-menu-dark .ant-menu-inline.ant-menu-sub .ant-menu-item-selected span,
  .sider.dark ul.ant-menu.ant-menu-dark .ant-menu-inline.ant-menu-sub .ant-menu-item-selected i,
  .sider.dark ul.ant-menu.ant-menu-dark .ant-menu-item-selected i,
  .sider.dark ul.ant-menu.ant-menu-dark .ant-menu-item-selected span,
  .ant-menu-dark.ant-menu-horizontal > .ant-menu-item,
  .ant-menu-dark.ant-menu-horizontal > .ant-menu-submenu,
  .ant-menu-dark .ant-menu-vertical.ant-menu-sub li a,
  .ant-menu-dark .ant-menu-vertical > .ant-menu-submenu > .ant-menu-submenu-title,
  .ant-menu-dark.ant-menu-submenu-open  .ant-menu-vertical.ant-menu-sub.ant-menu-submenu-content li a,
  .ant-menu-submenu.ant-menu-submenu-active .ant-menu-dark.ant-menu-submenu-placement-rightTop .ant-menu-submenu-content .ant-menu-submenu .ant-menu-submenu-title span{
    color: #fff;
  }
  .sider.dark ul.ant-menu .ant-menu-item:hover,
  .ant-menu-dark .ant-menu-vertical.ant-menu-sub li:hover{
    background: #042749 !important;
  }
  .sider.dark ul.ant-menu.ant-menu-dark .ant-menu-submenu-title:hover{
    background: transparent;
  }
  .sider.dark ul.ant-menu.ant-menu-dark .ant-menu-item:hover i,
  .sider.dark ul.ant-menu.ant-menu-dark .ant-menu-item:hover span,
  .sider.dark ul.ant-menu.ant-menu-dark .ant-menu-item.ant-menu-item-selected:hover span,
  .sider.dark ul.ant-menu.ant-menu-dark .ant-menu-submenu-title:hover i,
  .sider.dark ul.ant-menu.ant-menu-dark .ant-menu-submenu-title:hover span,
  .ant-menu-dark.ant-menu-inline .ant-menu-submenu-open .ant-menu-submenu-title,
  .ant-menu-dark .ant-menu-vertical.ant-menu-sub>li a:hover,
  .ant-menu-dark .ant-menu-vertical > .ant-menu-submenu.ant-menu-submenu-open  > .ant-menu-submenu-title,
  .ant-menu-dark .ant-menu-vertical.ant-menu-sub.ant-menu-submenu-content li a:hover,
  .ant-menu-dark .ant-menu-vertical > .ant-menu-submenu.ant-menu-submenu-active > .ant-menu-submenu-title,
  .ant-menu-submenu.ant-menu-submenu-active .ant-menu-dark.ant-menu-submenu-placement-rightTop .ant-menu-submenu-content .ant-menu-submenu:hover .ant-menu-submenu-title span,
  .sider.dark ul.ant-menu.ant-menu-dark .ant-menu-inline.ant-menu-sub .ant-menu-item-selected:hover i{
    color: @primary-color;
  }
  .ant-menu.ant-menu-root.ant-menu-dark > .ant-menu-item:first-child > a,
  .ant-menu.ant-menu-root.ant-menu-dark > .ant-menu-item:first-child > a:hover,
  .dark .ant-menu-dark .ant-menu-item, .ant-menu-dark .ant-menu-item-group-title,
  .dark .ant-menu-dark .ant-menu-item > a,
  .ant-menu-dark,
  .ant-menu-dark .ant-menu-sub,
  .ant-menu-dark.ant-menu-inline .ant-menu-item,
  .ant-menu-dark.ant-menu-inline .ant-menu-submenu-title,
  .dark .ant-menu.ant-menu-dark.ant-menu-horizontal .ant-menu-item-selected span,
  .dark .ant-menu.ant-menu-dark.ant-menu-horizontal .ant-menu-item-selected i,
  .sider.dark ul.ant-menu.ant-menu-dark .ant-menu-item.ant-menu-item-selected:hover i
  {
    color: #fff;
  }
  .ant-menu-dark .ant-menu-submenu-title .ant-menu-submenu-arrow,
  .ant-menu-dark .ant-menu-sub .ant-menu-submenu-title .ant-menu-submenu-arrow{
    opacity: 1 !important;
  }
  .ant-menu-dark .ant-menu-submenu-title:hover .ant-menu-submenu-arrow::after,
  .ant-menu-dark .ant-menu-sub .ant-menu-submenu-title:hover .ant-menu-submenu-arrow::after,
  .ant-menu-dark .ant-menu-submenu-title:hover .ant-menu-submenu-arrow::before,
  .ant-menu-dark .ant-menu-sub .ant-menu-submenu-title:hover .ant-menu-submenu-arrow::before,
  .ant-menu-dark .ant-menu-sub.ant-menu-submenu-open .ant-menu-submenu-title .ant-menu-submenu-arrow::after,
  .ant-menu-dark .ant-menu-sub.ant-menu-submenu-open .ant-menu-submenu-title .ant-menu-submenu-arrow::before,
  .ant-menu-dark .ant-menu-submenu-open .ant-menu-submenu-title .ant-menu-submenu-arrow::after,
  .ant-menu-dark .ant-menu-submenu-open .ant-menu-submenu-title .ant-menu-submenu-arrow::before{
    background: @primary-color !important;
  }

  .ant-menu-dark .ant-menu-submenu-active.ant-menu-submenu-selected > .ant-menu-submenu-title > .ant-menu-submenu-arrow::before,
  .ant-menu-dark .ant-menu-submenu-active.ant-menu-submenu-selected > .ant-menu-submenu-title > .ant-menu-submenu-arrow::after,
  .ant-menu-dark .ant-menu-submenu-active.ant-menu-submenu-vertical-left > .ant-menu-submenu-title > .ant-menu-submenu-arrow::before,
  .ant-menu-dark .ant-menu-submenu-active.ant-menu-submenu-vertical-left > .ant-menu-submenu-title > .ant-menu-submenu-arrow::after,
  .ant-menu-dark .ant-menu-submenu-open.ant-menu-submenu-active .ant-menu-submenu-title .ant-menu-submenu-arrow::after,
  .ant-menu-dark .ant-menu-submenu-open.ant-menu-submenu-active .ant-menu-submenu-title .ant-menu-submenu-arrow::before
  {
    background: @primary-color;
  }
  .ant-menu-dark .ant-menu-submenu-open.ant-menu-submenu-active .ant-menu-submenu-placement-rightTop .ant-menu-vertical-left .ant-menu-submenu-title .ant-menu-submenu-arrow::before,
  .ant-menu-dark .ant-menu-submenu-open.ant-menu-submenu-active .ant-menu-submenu-placement-rightTop .ant-menu-vertical-left .ant-menu-submenu-title .ant-menu-submenu-arrow::after{
    background: #fff !important;
  }
  .ant-menu-dark .ant-menu-submenu-open.ant-menu-submenu-active .ant-menu-submenu-placement-rightTop .ant-menu-vertical-left:hover .ant-menu-submenu-title .ant-menu-submenu-arrow::before,
  .ant-menu-dark .ant-menu-submenu-open.ant-menu-submenu-active .ant-menu-submenu-placement-rightTop .ant-menu-vertical-left:hover .ant-menu-submenu-title .ant-menu-submenu-arrow::after{
    background: @primary-color !important;
  }
    // drawer-sider 自定义
  .ant-drawer.drawer-sider {
    .sider {
      box-shadow: none;
    }

    &.dark {
      .ant-drawer-content {
        background-color: rgb(0, 21, 41);
      }
    }
    &.light {
      box-shadow: none;
      .ant-drawer-content {
        background-color: #fff;
      }
    }

    .ant-drawer-body {
      padding: 0 !important;
    }
  }

  // 菜单样式
  .sider {
    box-shadow: 0px 100px 6px 0 rgba(0, 21, 41, .35);
    position: relative;
    z-index: 10;

    &.ant-fixed-sidemenu {
      position: fixed;
      height: 100%;
    }

    .logo {
      height: 64px;
      position: relative;
      line-height: 64px;
      padding-left: 24px;
      -webkit-transition: all .3s;
      transition: all .3s;
      background: #001529;
      overflow: hidden;

      img, h1 {
        display: inline-block;
        vertical-align: middle;
      }

      img {
        height: 52px!important;
      }

      h1 {
        color: #fff;
        font-size: 18px;
        margin: 0 0 0 8px;
        font-family: "Chinese Quote", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
        font-weight: 600;
      }
    }

    &.light {
      background-color: #fff;
      box-shadow: 0px 100px 8px 0 rgba(29, 35, 41, 0.05);
      height:100vh;
      .logo {
        background: #fff;
        box-shadow: 1px 1px 0 0 #e8e8e8;

        h1 {
          color: unset;
        }
      }

      .ant-menu-light {
        border-right-color: transparent;
      }
    }

  }

  // 外置的样式控制
  .user-dropdown-menu-wrapper.ant-dropdown-menu {
    padding: 4px 0;

    .ant-dropdown-menu-item {
      width: 160px;
    }

    .ant-dropdown-menu-item > .anticon:first-child,
    .ant-dropdown-menu-item > a > .anticon:first-child,
    .ant-dropdown-menu-submenu-title > .anticon:first-child
    .ant-dropdown-menu-submenu-title > a > .anticon:first-child {
      min-width: 12px;
      margin-right: 8px;
    }

  }

  // 数据列表 样式
  .table-alert {
    margin-bottom: 16px;
  }
  .table-page-search-wrapper {
    .ant-form-inline {
      .ant-form-item {
        display: flex;
        margin-bottom: 10px;
        margin-right: 0;

        .ant-form-item-control-wrapper {
          flex: 1 1;
          display: inline-block;
          vertical-align: middle;
        }

        > .ant-form-item-label {
          line-height: 30px!important;
          padding-right: 0;
          width: 20%;
        }
        .ant-form-item-control {
          height: 32px;
          line-height: 32px;
        }
      }
    }
    .table-page-search-submitButtons {
      display: block;
      margin-bottom: 15px;
      white-space: nowrap;
    }

  }

  .content {

    .table-operator {
      margin-bottom: 18px;

      button {
        margin-right: 8px;
      }
    }
  }
 .ant-menu-dark .ant-menu-vertical.ant-menu-sub li:hover{
    background-color: #001528;
  }
   .ant-menu-submenu-popup.ant-menu-dark .ant-menu-item-selected{
     background-color: #001528 !important;
  }
  .ant-menu-submenu-popup.ant-menu-dark .ant-menu-item-selected span{
    color: rgb(24, 144, 255);
  }
   .ant-menu-submenu-popup.ant-menu-dark .ant-menu-item-selected i{
    color: rgb(24, 144, 255);
  }
  .ant-menu-dark .ant-menu-sub{
    background: #000c17 !important;
   .ant-menu-submenu-open,.ant-menu-submenu-active{
      color: #FFFFFF !important;
    }
  }
  /*简约版菜单修改*/
  .projectName{
    font-size: 20px;
    font-weight: bold;
    padding-left: 16px;
  }
 .ant-layout-sider-contracted{
    flex: 0 0 90px !important;
    max-width: 90px!important;
    min-width: 90px!important;
    width: 90px!important;
    .ant-layout-sider-children{
      .logo{
        padding-left: 18px;
        margin: 10px 0;
      }
      .ant-menu-inline-collapsed {
        padding-top: 10px;
        width: 90px;
        .ant-menu-item,.ant-menu-submenu{
          padding:18px 0 0 !important;
          height: 80px;
          margin: 0;
          transition:all 0s;
          i.anticon,i.iconfont{
            width: 100%;
            float: left;
            height: 24px;
            line-height:24px;
            font-size: 22px;
            color: #fff;
            text-align: center;
          }
          .anticon + span,.iconfont + span{
            opacity: 1;
            width: 100%;
            max-width: 100%;
            float: left;
            text-align: center;
            line-height: 30px;
            color: #fff;
          }

          div.ant-menu-submenu-title{
            padding:0!important;
            margin: 0 !important;
            min-height: 60px;
          }

        }
        .ant-menu-submenu-selected{
          background:#1890ff!important;
          color: #fff!important;
        }
        .ant-menu-submenu-selected:hover{
          background:@primary-color !important;
          color: #fff!important;
          .anticon{
            color: #fff!important;
          }
          span{
            color: #fff!important;
          }

        }
        .ant-menu-item-selected{
          background:@primary-color !important;
          color: #fff!important;
          height: 80px;
        }
        .ant-menu-item-selected:hover{
          background:@primary-color !important;
          color: #fff!important;
          height: 80px;
        }
      }
    }
  }
  /*浅色*/
  .sider.light.ant-layout-sider-contracted{
    .ant-layout-sider-children{
      .ant-menu-inline-collapsed {
        .ant-menu-item,.ant-menu-submenu{
          i.anticon{
            color: @primary-color ;
          }
          .anticon + span{
            color: #333!important;
          }
        }
        li.ant-menu-submenu:hover,li.ant-menu-item:hover{
          background: #e0f3ff !important;
        }
        li.ant-menu-submenu.ant-menu-submenu-selected:hover{
          background: @primary-color ;
        }
        .ant-menu:hover.ant-menu-submenu:hover{
          .ant-menu-submenu-title>span>span{
            color: @primary-color !important;
          }
        }
        .ant-menu-submenu-selected,.ant-menu-item-selected{
          background:#1890ff!important;
          color: @primary-color !important;
          i.anticon{
            color: #fff!important;
          }
          .anticon + span{
            color: #fff!important;
          }
        }
        .ant-menu-submenu-selected:hover{
          background:#1890ff!important;
          color: #fff!important;
          i.anticon{
            color: #fff!important;
          }
          span{
            color: #fff!important;
          }
        }
        .ant-menu-item-selected{
          background:@primary-color !important;
          color: #fff!important;
        }
        .ant-menu-item-selected:hover{
          background:@primary-color !important;
          color: #fff!important;
        }
      }
    }
  }
  .sider.light.ant-layout-sider-contracted ul.ant-menu .ant-menu-item.ant-menu-item-selected:hover{
    background:@primary-color !important;
    .anticon{
      color: #fff!important;
    }
    span{
      color: #fff!important;
    }
  }
  .briefMenu{
    .ant-header-fixedHeader {
      position: fixed;
      top: 0;
      right: 0;
      z-index: 9;
      width: 100%;
      transition: width .2s;

      &.ant-header-side-opened {
        width: calc(100% - 90px)
      }
    }
  }
  /*深色*/
  .sider.dark.ant-layout-sider-contracted ul.ant-menu .ant-menu-item.ant-menu-item-selected:hover{
    background:@primary-color !important;
    .anticon{
      color: #fff!important;
    }
    span{
      color: #fff!important;
    }
  }
  .ant-layout-sider-contracted .ant-layout-sider-children .ant-menu-inline-collapsed .ant-menu-submenu:hover,
  .ant-menu.ant-menu-dark.ant-menu-horizontal .ant-menu-item:hover{
    background-color: #042749;
  }
/*简约版本样式结束*/
/*混合模式样式开始*/
  .mixedMenu{
    .ant-header-fixedHeader {
      position: fixed;
      top: 0;
      right: 0;
      z-index: 9;
      width: 100%;
      transition: width .2s;
      padding-left: 208px !important;

      &.ant-header-side-opened {
        width: 100%
      }
    }

    .ant-header-fixedHeader-no-sub {
      position: fixed;
      top: 0;
      right: 0;
      z-index: 9;
      width: 100%;
      transition: width .2s;

      &.ant-header-side-opened {
        width: 100%
      }
    }

    .ant-menu-horizontal > .ant-menu-item{
      border-bottom: none;
    }
    .ant-menu-horizontal > .ant-menu-item:hover{
      border-bottom: none;
      background: #0988fd;
    }
  }
  .ant-menu-submenu-popup.ant-menu-dark .ant-menu-item-selected span{
    color: #1890ff !important;
  }
  @media screen and (max-width: 1085px) {
    .sidemenu.sidemenu1.content-width-Fixed{
      padding-left: 10px!important;
    }
  }
</style>
